package com.bestcem.xm.label.entity.pojo;

import com.bestcem.xm.label.entity.mysql.LabelEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.Date;

/**
 * 标签DO
 *
 * @author zh.zhang <zh.zhang@idiaoyan.com>
 * @version v1.0
 * @date 2021-09-23
 */
@Getter
@Setter
@ToString
public class LabelDO {

    /**
     * 主键
     */
    private String labelId;

    /**
     * 组织id
     */
    private String orgId;

    /**
     * 标签组id
     */
    private String labelGroupId;

    /**
     * 标签名称
     */
    private String name;

    /**
     * 手动打标签: 0-false, 1-true
     */
    private Integer manual;

    /**
     * 自动打标签0-false 1-true
     */
    private Integer auto;

    /**
     * 是否样例数据 0 否 1 是
     */
    private Integer isSample;

    /**
     * 创建时间(北京时间)
     */
    private Date createTime;

    /**
     * 修改时间(北京时间)
     */
    private Date updateTime;

    public static LabelDO toDo(LabelEntity entity) {
        if (entity == null) {
            return null;
        }
        LabelDO labelDO = new LabelDO();
        labelDO.setAuto(entity.getAuto());
        labelDO.setCreateTime(entity.getCreateTime());
        labelDO.setLabelGroupId(entity.getLabelGroupId());
        labelDO.setLabelId(entity.getLabelId());
        labelDO.setManual(entity.getManual());
        labelDO.setName(entity.getName());
        labelDO.setOrgId(entity.getOrgId());
        labelDO.setIsSample(entity.getIsSample());
        labelDO.setUpdateTime(entity.getUpdateTime());
        return labelDO;
    }

    public static LabelEntity toEntity(LabelDO labelDO) {
        if (labelDO == null) {
            return null;
        }
        LabelEntity labelEntity = new LabelEntity();
        labelEntity.setAuto(labelDO.getAuto());
        labelEntity.setCreateTime(labelDO.getCreateTime());
        labelEntity.setLabelGroupId(labelDO.getLabelGroupId());
        labelEntity.setLabelId(labelDO.getLabelId());
        labelEntity.setManual(labelDO.getManual());
        labelEntity.setName(labelDO.getName());
        labelEntity.setOrgId(labelDO.getOrgId());
        labelEntity.setIsSample(labelDO.getIsSample());
        labelEntity.setUpdateTime(labelDO.getUpdateTime());
        return labelEntity;
    }

}
